<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./js/vue.js"></script>
    <title>姓名methods语法实现</title>
    <style> 
       
    </style>
</head>
<body>
    <div id="root">
        <h1>姓名methods语法实现</h1>
        姓:<input type="text" v-model="firstName" @keyup.huiche="handleEnter">
        <br>
        名:<input type="text" v-model="lastName" @keyup.huiche="handleEnter">
        <br>
        <!-- methods会被执行5次，没有缓存 -->
        全名:<span>{{fullName()}}</span>
        <br>
        全名:<span>{{fullName()}}</span>
        <br>
        全名:<span>{{fullName()}}</span>
        <br>
        全名:<span>{{fullName()}}</span>
        <br>
        全名:<span>{{fullName()}}</span>
    </div>
</body>
<script>
    Vue.config.keyCodes.huiche = 13; // 自定义tab键别名
    var vm = new Vue({
        el: '#root',
        data: {
            firstName: '尚硅谷', 
            lastName: '学院'
        },
        methods: {
           fullName(){
                console.log("重新调用fullname方法")
               return this.firstName +'-'+ this.lastName;
           }
        }
    })          
</script>
</html>